home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 1.iso / games / vietl25a.zip / wes.mst < prev   
Text File  |  1995-06-01  |  10KB  |  270 lines

  1. '************************************************************************************
  2. '*                       SETUP VIETNAMESE LESSON DEMODISK
  3. '************************************************************************************
  4. '$DEFINE DEBUG  ''Define for script development/debugging
  5.  
  6. '$INCLUDE 'setupapi.inc'
  7. '$INCLUDE 'msdetect.inc'
  8.  
  9. ''Dialog ID's
  10. CONST WELCOME       = 100
  11. CONST ASKQUIT       = 200
  12. CONST DESTPATH      = 300
  13. CONST EXITFAILURE   = 400
  14. CONST EXITQUIT      = 600
  15. CONST EXITSUCCESS   = 700
  16. CONST OPTIONS       = 800
  17. CONST APPHELP       = 900
  18. CONST BADPATH       = 6400
  19.  
  20. ''Bitmap ID
  21. CONST LOGO = 1
  22.  
  23. GLOBAL DEST$        ''Default destination directory.
  24. GLOBAL WinDir$
  25. GLOBAL WinSysDir$
  26. GLOBAL OPTCUR$      ''Option selection from option dialog.
  27.  
  28. DECLARE SUB Install
  29. DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  30.  
  31.  
  32. INIT:
  33.     CUIDLL$ = "mscuistf.dll"            ''Custom user interface dll
  34.     HELPPROC$ = "FHelpDlgProc"          ''Help dialog procedure
  35.  
  36.     SetBitmap CUIDLL$, LOGO
  37.     SetTitle "Vietnamese Lesson Install - Installation de Vietnamese Lesson"
  38.  
  39.     szInf$ = GetSymbolValue("STF_SRCINFPATH")
  40.     IF szInf$ = "" THEN
  41.     szInf$ = GetSymbolValue("STF_CWDDIR") + "wes.inf"
  42.     END IF
  43.     ReadInfFile szInf$
  44.  
  45.     OPTCUR$ = "1"
  46.     DEST$ = "C:\DEMO\VIET"
  47.  
  48. '$IFDEF DEBUG
  49.     i% = SetSizeCheckMode(scmOnIgnore)    '' could use scmOff; def = scmOnFatal
  50.     WinDrive$ = MID$(GetWindowsDir, 1, 1)
  51.     IF IsDriveValid(WinDrive$) = 0 THEN
  52.     i% = DoMsgBox("Windows drive ('"+WinDrive$+"') is not a valid drive. - Nom du lecteur incorrecte", "DEBUG", MB_TASKMODAL+MB_ICONHAND+MB_OK)
  53.     GOTO QUIT
  54.     END IF
  55. '$ENDIF ''DEBUG
  56.  
  57.  
  58. WELCOME:
  59.  
  60.  
  61. OPTION:
  62.     SetSymbolValue "RadioDefault", OPTCUR$
  63. OPTL1:
  64.     sz$ = UIStartDlg(CUIDLL$, OPTIONS, "FRadioDlgProc", APPHELP, HELPPROC$)
  65.     OPTCUR$ = GetSymbolValue("ButtonChecked")
  66.  
  67.     IF sz$ = "CONTINUE" THEN
  68.     UIPop(1)
  69.     ELSEIF sz$ = "REACTIVATE" THEN
  70.     GOTO OPTL1
  71.     ELSE
  72.     GOSUB ASKQUIT
  73.     GOTO OPTION
  74.     END IF
  75.  
  76.  
  77.  
  78. GETPATH:
  79.     SetSymbolValue "EditTextIn", DEST$
  80.     SetSymbolValue "EditFocus", "END"
  81. GETPATHL1:
  82.     sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, HELPPROC$)
  83.     DEST$ = GetSymbolValue("EditTextOut")
  84.  
  85.     IF sz$ = "CONTINUE" THEN
  86.     IF IsDirWritable(DEST$) = 0 THEN
  87.         GOSUB BADPATH
  88.         GOTO GETPATHL1
  89.     END IF
  90.     UIPop 1
  91.     ELSEIF sz$ = "REACTIVATE" THEN
  92.     GOTO GETPATHL1
  93.     ELSEIF sz$ = "BACK" THEN
  94.     UIPop 1
  95.     GOTO OPTION
  96.     ELSE
  97.     GOSUB ASKQUIT
  98.     GOTO GETPATH
  99.     END IF
  100.  
  101.  
  102.     Install
  103.  
  104.  
  105. QUIT:
  106.     ON ERROR GOTO ERRQUIT
  107.  
  108.     IF ERR = 0 THEN
  109.     dlg% = EXITSUCCESS
  110.     ELSEIF ERR = STFQUIT THEN
  111.     dlg% = EXITQUIT
  112.     ELSE
  113.     dlg% = EXITFAILURE
  114.     END IF
  115. QUITL1:
  116.     sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
  117.     IF sz$ = "REACTIVATE" THEN
  118.     GOTO QUITL1
  119.     END IF
  120.     UIPop 1
  121.  
  122.     END
  123.  
  124. ERRQUIT:
  125.     IF OPTCUR$ = "1" THEN
  126.     i% = DoMsgBox("Setup sources were corrupted, please read file Dealer.wri and contact your local reseller.", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  127.     ELSE
  128.     i% = DoMsgBox("Les fichiers Setup sont endommagΘs, lisez le fichier Contacts.wri et contacter votre revendeur le plus proche.", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  129.     END IF
  130. END
  131.  
  132.  
  133.  
  134. BADPATH:
  135.     sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
  136.     IF sz$ = "REACTIVATE" THEN
  137.     GOTO BADPATH
  138.     END IF
  139.     UIPop 1
  140.     RETURN
  141.  
  142.  
  143.  
  144. ASKQUIT:
  145.     sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
  146.  
  147.     IF sz$ = "EXIT" THEN
  148.     UIPopAll
  149.     ERROR STFQUIT
  150.     ELSEIF sz$ = "REACTIVATE" THEN
  151.     GOTO ASKQUIT
  152.     ELSE
  153.     UIPop 1
  154.     END IF
  155.     RETURN
  156.  
  157.  
  158.  
  159. '**
  160. '** Purpose:
  161. '**     Builds the copy list and performs all installation operations.
  162. '** Arguments:
  163. '**     none.
  164. '** Returns:
  165. '**     none.
  166. '*************************************************************************
  167. SUB Install STATIC
  168.  
  169.     SrcDir$ = GetSymbolValue("STF_SRCDIR")
  170.     CreateDir DEST$, cmoNone
  171.     CreateDir DEST$+"\ttf", cmoNone
  172.     CreateDir DEST$+"\Info", cmoNone
  173.     CreateDir DEST$+"\files", cmoNone
  174.     CreateDir DEST$+"\Dict", cmoNone
  175.  
  176.     OpenLogFile MakePath(DEST$, "LOGFILE.OUT"), 0
  177.     WriteToLogFile ""
  178.     WriteToLogFile "  User chose as destination directory: '" + DEST$ + "'"
  179.     WriteToLogFile "  User chose option: '" + OPTCUR$ + "'"
  180.     WriteToLogFile ""
  181.     WriteToLogFile "May have had to create the directory: " + DEST$
  182.     WriteToLogFile ""
  183.  
  184.     WinDir$ = GetWindowsDir()
  185.     WinSysDir$ = GetWindowsSysDir()       
  186.     AddSectionFilesToCopyList "WesLesson", SrcDir$, DEST$
  187.     AddSectionFilesToCopyList "WesFiles", SrcDir$, DEST$
  188.     AddSectionFilesToCopyList "Ttf", SrcDir$, DEST$+"\ttf"
  189. IF OPTCUR$ = "1" THEN
  190.    AddSectionFilesToCopyList "InfoGB", SrcDir$, DEST$+"\Info"
  191. ELSE
  192.   AddSectionFilesToCopyList "InfoFF", SrcDir$, DEST$+"\Info"
  193. END IF
  194.     AddSectionFilesToCopyList "Files", SrcDir$, DEST$
  195.     CopyFilesInCopyList
  196.     ini$ = GetWindowsDir()+"CALVIET.INI"
  197.     CreateIniKeyValue ini$, "Lesson", "Timer", "15000" , cmoOverwrite
  198.     CreateIniKeyValue ini$, "VisualOption", "Langue", "viet" , cmoOverwrite
  199.     CreateIniKeyValue ini$, "Lesson", "Item", "0" , cmoOverwrite
  200.     CreateIniKeyValue ini$, "Option", "Sounds", "2" , cmoOverwrite
  201.     CreateIniKeyValue ini$, "OptionExercise", "Sounds", "2" , cmoOverwrite
  202.     CreateIniKeyValue ini$, "Lesson", "First", "0" , cmoOverwrite
  203.     CreateIniKeyValue ini$, "Lesson", "Guide", "1" , cmoOverwrite
  204.     CreateIniKeyValue ini$, "Lesson", "Phonetic", "1" , cmoOverwrite
  205.     CreateIniKeyValue ini$, "Lesson", "LessonType", "0" , cmoOverwrite 
  206.     CreateIniKeyValue ini$, "Lesson", "DigitalVideo", "1" , cmoOverwrite 
  207.     CreateIniKeyValue ini$, "CurrentLesson", "Menu", "1580" , cmoOverwrite
  208.     CreateIniKeyValue ini$, "Police", "FirstFont", "UHoαi 1.1" , cmoOverwrite
  209.     CreateIniKeyValue ini$, "Police", "Size", "30" , cmoOverwrite
  210.     CreateIniKeyValue ini$, "ZipFiles", "DirectAcess", "NO" , cmoNone
  211.     CreateProgmanGroup "Vietnamese Lesson", "", cmoNone
  212.     ShowProgmanGroup  "Vietnamese Lesson", 1, cmoNone
  213.     CreateProgmanItem "Vietnamese Lesson", "Demo Vietnamese Lesson", MakePath(DEST$,"Course.exe"), "", cmoOverwrite
  214.     CreateIniKeyValue ini$, "PictExercise", "Language", "viet" , cmoOverwrite
  215.     CreateIniKeyValue ini$, "TranslateEx", "From", "viet" , cmoOverwrite
  216. IF OPTCUR$ = "1" THEN
  217.     CreateIniKeyValue ini$, "TranslateEx", "To", "anglais" , cmoOverwrite
  218.     CreateIniKeyValue ini$, "Dictionnary", "From", "viet" , cmoOverwrite
  219.     CreateIniKeyValue ini$, "Dictionnary", "To", "anglais" , cmoOverwrite
  220.     CreateIniKeyValue ini$, "Option", "Phonetic", "anglais" , cmoOverwrite
  221.     CreateIniKeyValue ini$, "Option", "Traduction", "anglais" , cmoOverwrite
  222.     CreateIniKeyValue ini$, "Lesson", "Langue", "2" , cmoOverwrite
  223.     CreateProgmanItem "Vietnamese Lesson", "Vietnamese Lesson Help", "winhelp.exe "+MakePath(DEST$,"lessongb.hlp"), "", cmoOverwrite
  224.     CreateProgmanItem "Vietnamese Lesson", "Demo Vietnamese Lesson Exercises", MakePath(DEST$,"Exercise.exe"), "", cmoOverwrite
  225.     CreateProgmanItem "Vietnamese Lesson", "Your technical support", "write.exe "+MakePath(DEST$+"\Info","suppgb.wri"), "", cmoOverwrite
  226.     CreateProgmanItem "Vietnamese Lesson", "To order Vietnamese Lesson", "write.exe "+MakePath(DEST$+"\Info","softgb.wri"), "", cmoOverwrite
  227.     CreateProgmanItem "Vietnamese Lesson", "About Vietnamese Lesson Demodisk", "write.exe "+MakePath(DEST$+"\Info","warnin.wri"), "", cmoOverwrite
  228.     CreateProgmanItem "Vietnamese Lesson", "List of Vietnamese characters", "write.exe "+MakePath(DEST$+"\Info","vietgb.wri"), "",cmoOverwrite
  229. ELSE
  230.     CreateIniKeyValue ini$, "TranslateEx", "To", "francais" , cmoOverwrite
  231.     CreateIniKeyValue ini$, "Dictionnary", "From", "viet" , cmoOverwrite
  232.     CreateIniKeyValue ini$, "Dictionnary", "To", "francais" , cmoOverwrite
  233.     CreateIniKeyValue ini$, "Option", "Phonetic", "francais" , cmoOverwrite
  234.     CreateIniKeyValue ini$, "Option", "Traduction", "francais" , cmoOverwrite
  235.     CreateIniKeyValue ini$, "Lesson", "Langue", "1" , cmoOverwrite
  236.     CreateProgmanItem "Vietnamese Lesson", "Aide Vietnamese Lesson", "winhelp.exe "+MakePath(DEST$,"lessonff.hlp"), "", cmoOverwrite
  237.     CreateProgmanItem "Vietnamese Lesson", "Demo Vietnamese Lesson Exercices", MakePath(DEST$,"Exercise.exe"), "", cmoOverwrite
  238.     CreateProgmanItem "Vietnamese Lesson", "Votre support technique", "write.exe "+MakePath(DEST$+"\Info","suppff.wri"), "", cmoOverwrite
  239.     CreateProgmanItem "Vietnamese Lesson", "Pour commander Vietnamese Lesson", "write.exe "+MakePath(DEST$+"\Info","softff.wri"), "", cmoOverwrite
  240.     CreateProgmanItem "Vietnamese Lesson", "A propos de Vietnamese Lesson Demodisk", "write.exe "+MakePath(DEST$+"\Info","limite.wri"), "", cmoOverwrite
  241.     CreateProgmanItem "Vietnamese Lesson", "Liste des caractΦres vietnamiennes", "write.exe "+MakePath(DEST$+"\Info","vietff.wri"), "",cmoOverwrite
  242. END IF
  243. AddDos5Help "YOURAPP", "A brief help text for your Windows application."+chr$(10)+"It can be continued on another line with chr$(10).", cmoNone
  244. CloseLogFile
  245. END SUB
  246.  
  247.  
  248.  
  249. '**
  250. '** Purpose:
  251. '**     Appends a file name to the end of a directory path,
  252. '**     inserting a backslash character as needed.
  253. '** Arguments:
  254. '**     szDir$  - full directory path (with optional ending "\")
  255. '**     szFile$ - filename to append to directory
  256. '** Returns:
  257. '**     Resulting fully qualified path name.
  258. '*************************************************************************
  259. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  260.     IF szDir$ = "" THEN
  261.     MakePath = szFile$
  262.     ELSEIF szFile$ = "" THEN
  263.     MakePath = szDir$
  264.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  265.     MakePath = szDir$ + szFile$
  266.     ELSE
  267.     MakePath = szDir$ + "\" + szFile$
  268.     END IF
  269. END FUNCTION
  270.